<?php
/**
 * Created by PhpStorm
 * User: shen.zk
 * Date: 2023/10/23
 * Time: 14:53
 * Comment: ''
 */

namespace App\Repository;

use App\Models\Assort;

class AssortRepo extends BaseRepo
{
    /**
     * 获取全部创作者分类领取信息
     * @return \Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection
     * @author shen.zk
     * @date 2023-10-23 14:57
     */
    public function getAssortData()
    {
        return Assort::query()->where('status',1)->orderBy('sort','desc')->orderBy('id','desc')->get();
    }

    /**
     * 根据ID获取记录
     * @param int $id
     * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object|null
     * @author shen.zk
     * @date 2023-10-23 15:49
     */
    public function getById(int $id)
    {
        return Assort::query()->where('id',$id)->first();
    }
}
